package com.smart.stock.common.util;

/**
 * @Author wlj @Date 2020/1/2 3:14 下午
 */
public enum ResultCode {

    /** */
    SUCCESS(0, "执行成功"),
    FAILED(-1, "执行失败"),
    VALIDATE_FAILED(-2, "参数检验失败"),
    UNAUTHORIZED(-3, "暂未登录或token已经过期"),
    FORBIDDEN(-4, "没有相关权限"),
    DUPLICATE(-5, "数据重复提交, 请检查"),

    HTTP_400(400, "请求中有语法问题，或不能满足请求"),
    HTTP_401(401, "未授权"),
    HTTP_404(404, "找不到路径"),
    HTTP_405(405, "不支持该方法请求"),
    HTTP_415(415, "服务器拒绝服务请求，因为不支持请求实体的格式"),
    HTTP_500(500, "服务器中出现的错误"),

    /**
     * 自定义异常 错误类型
     */
    OBJECT_NOT_FOUND(-10,"对象不存在"),
    INVALID_PARAMS(-11,"参数不正确"),
    RESULT_NOT_EXIST(-12,"记录不存在"),
    REPEAT_RECORD(-13,"已存在相同的记录");

    private int code;

    private String msg;

    ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
